package pl.edu.pw.perg.compinfodb.ui;

import java.awt.Component;

import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;

public class RowHighlightPredicate implements HighlightPredicate {

	private int highlitedRow;
	
	public RowHighlightPredicate(int row){
		highlitedRow = row;
	}
	
	public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
//        int modelIndex = adapter.viewToModel(adapter.row);
		JXTable table = (JXTable) adapter.getComponent();
        return highlitedRow == table.convertRowIndexToModel(adapter.row);
	}

	public void setHighlitedRow(int highlitedRow) {
		this.highlitedRow = highlitedRow;
	}

}
